﻿@using System.Web.Mvc.Ajax
@using System.Web.Mvc.Html
@using nanoCMS.Forum.WebUI.Models.AdminViewModels
@model ForumAdministrationVM

<div id="edit_form">
    @using (Ajax.BeginForm("Save", "ForumAdmin", new { }, new AjaxOptions { HttpMethod = "post", UpdateTargetId = "admin_content" }, new { }))
    {
        <input type="hidden" name="ForumID" id="ForumEntryVM_ForumID" value="@(Model.ForumEntry.ForumID)"/>
        <fieldset id="">
            <legend>Create/Edit forum</legend>
            <div>
		        <label for="ForumEntryVM_Title">Title:</label> 
		        <input type="text" name="Title" id="ForumEntryVM_Title" value="@Model.ForumEntry.Title"/>
            </div>
            <div>
                <label for="ForumEntryVM_Description">Description:</label> 
		        <input type="text" name="Description" id="ForumEntryVM_Description" value="@Model.ForumEntry.Description"/>
            </div>
            <div>
                <label for="ForumEntryVM_ParentForumID">Parent</label>
                <select id="ForumEntryVM_ParentForumID" name="ParentForumID">
                    <option value="0">-- none --</option>
                    @foreach (var item in Model.ForumDisplay)
                    {
                        Html.RenderPartial("ForumSelectBoxPartial", item); 
                    }
                </select>
            </div>
            <div>
                <input type="hidden" name="UserID" value="@Model.ForumEntry.ForumID"/>
                <input type="submit" value="Submit" />
            </div>
	    </fieldset>
        
    }
</div>
<div id="forums_display">
    <fieldset>
        <legend>Forums</legend>
        @foreach (var item in Model.ForumDisplay)
        {
            Html.RenderPartial("ForumDisplayPartial", item); 
        }
    </fieldset>
</div>